package com.yinhai.activity;





import com.androidquery.AQuery;
import com.lz.util.Utils;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.CompoundButton.OnCheckedChangeListener;
/**
 * 暂时没有用，可以删除
 * @author Administrator
 *
 */
public class DWTXLActivity extends Activity {
	private ImageView btn_back;
	private AQuery aq;
	private DWTXLActivity thisRef;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_zdtb);
		thisRef = this;
		//返回
		btn_back = (ImageView)findViewById(R.id.head_btn_back);
		btn_back.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				onBackPressed();
			}
		});
		
		CheckBox cbAutoLogin = (CheckBox) findViewById(R.id.cbzdtb);
		cbAutoLogin.setChecked(Utils.getDWTXL(thisRef));
		cbAutoLogin.setOnCheckedChangeListener(cbAutoLoginCheckedChanged);

		//aq.id(R.id.layzdtb).clicked(layAutoLoginClick);
		
		
	}
	
	
	OnClickListener layAutoLoginClick = new OnClickListener() {
		@Override
		public void onClick(View v) {
			aq.id(R.id.cbzdtb).click();
		}
	};
	/**
	 * 改变单位通讯录设置,保存到配置文件
	 * */
	OnCheckedChangeListener cbAutoLoginCheckedChanged = new OnCheckedChangeListener() {
		public void onCheckedChanged(CompoundButton buttonView,
				boolean isChecked) {
			Utils.SaveDWTXL(thisRef, isChecked);
			if(isChecked){
				//Utils.startMsgService(thisRef);
				Utils.showToast(thisRef, "单位通讯录自动同步已开起");
			}else{
				//Utils.stopMsgService(thisRef);
				Utils.showToast(thisRef, "单位通讯录自动同步已关闭");
			}
		}
	};
 
}
